Here is where I’ll load my libraries
library(ggthemes)
## Warning: package 'ggthemes' was built under R version 4.1.1
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.1.1
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.2 v dplyr 1.0.7
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(sf)
## Warning: package 'sf' was built under R version 4.1.1
## Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
library(ggspatial)
## Warning: package 'ggspatial' was built under R version 4.1.1
Here is where I’ll read in my data
OpenSpace <- st_read("OpenSpace.shp")
## Reading layer `RECREATION_OpenSpace' from data source
## `C:\Users\wlada\Documents\GitHub\assigment 1 final\assigment1-final\OpenSpace.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 249 features and 12 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 748098.9 ymin: 2953898 xmax: 773383.8 ymax: 2972589
## Projected CRS: NAD83 / Massachusetts Mainland (ftUS)
OpenSpace2 <- st_read("OpenSpace.gdb")
## Reading layer `RECREATION_OpenSpace' from data source
## `C:\Users\wlada\Documents\GitHub\assigment 1 final\assigment1-final\OpenSpace.gdb'
## using driver `OpenFileGDB'
## Simple feature collection with 249 features and 12 fields
## Geometry type: GEOMETRY
## Dimension: XY
## Bounding box: xmin: 748098.9 ymin: 2953898 xmax: 773383.8 ymax: 2972589
## Projected CRS: NAD83 / Massachusetts Mainland (ftUS)
ParkLight <- st_read("ParkLights.shp")
## Reading layer `INFRA_ParkLights' from data source
## `C:\Users\wlada\Documents\GitHub\assigment 1 final\assigment1-final\ParkLights.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 860 features and 20 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: -1.797693e+308 ymin: -1.797693e+308 xmax: 771250.5 ymax: 2971013
## Projected CRS: NAD83 / Massachusetts Mainland (ftUS)
ParkLightGDB <- st_read("ParkLights.gdb")
## Reading layer `INFRA_ParkLights' from data source
## `C:\Users\wlada\Documents\GitHub\assigment 1 final\assigment1-final\ParkLights.gdb'
## using driver `OpenFileGDB'
## Simple feature collection with 860 features and 20 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: 749932.1 ymin: 2954550 xmax: 6.052069e+15 ymax: 6.052069e+15
## Projected CRS: NAD83 / Massachusetts Mainland (ftUS)
Make my first map
map <- ggplot() +
geom_sf(data = OpenSpace2)
map
make my second map is just to try what i will get loading both OpenSpace in shp and gdb
map_2 <- ggplot() +
geom_sf(data = OpenSpace2) +
geom_sf(data = OpenSpace)
map_2
now I’m gonna map_3 with OpenSpace and ParkLIghts
map3 <- ggplot() +
geom_sf(data = OpenSpace) +
geom_sf(data = ParkLightGDB)
map3
map3 <- ggplot() +
geom_sf(data = OpenSpace) +
geom_sf(fill = "green")
map3
ggplot(ParkLightGDB) +
geom_sf(shape = 17, color = "blue", size = 5, alpha=0.1)
map3 <- ggplot(OpenSpace) +
geom_sf() +
geom_sf(data = ParkLightGDB) +
geom_sf(data = OpenSpace2)
map3
map3 <- ggplot(OpenSpace) +
geom_sf() +
geom_sf(data = ParkLightGDB, color = "yellow") +
geom_sf(data = OpenSpace2, color = "green")
map3
map4 <- ggplot(OpenSpace) +
geom_sf() +
geom_sf(data = ParkLightGDB, color = "yellow",
size = 0.01) +
geom_sf(data = OpenSpace2, color = "black",
size = 0.2,
fill = "green",
alpha = 0.15)
map4
map4 <- ggplot(OpenSpace) +
geom_sf() +
geom_sf(data = ParkLightGDB, color = "yellow",
size = 0.01) +
geom_sf(data = OpenSpace2, color = "black",
size = 0.2,
alpha = 0.15,
aes(fill = "OpenSpace2")) +
scale_fill_manual(values = "green", name = "")
map4
map4 <- ggplot(OpenSpace) +
geom_sf() +
geom_sf(data = ParkLightGDB,
size = 0.01,
aes(color = "yellow")) +
geom_sf(data = OpenSpace2, color = "black",
size = 0.2,
alpha = 0.15,
aes(fill = "OpenSpace2")) +
scale_fill_manual(values = "green", name = "")
scale_color_manual(values = c("yellow"), name = "")
## <ggproto object: Class ScaleDiscrete, Scale, gg>
## aesthetics: colour
## axis_order: function
## break_info: function
## break_positions: function
## breaks: waiver
## call: call
## clone: function
## dimension: function
## drop: TRUE
## expand: waiver
## get_breaks: function
## get_breaks_minor: function
## get_labels: function
## get_limits: function
## guide: legend
## is_discrete: function
## is_empty: function
## labels: waiver
## limits: NULL
## make_sec_title: function
## make_title: function
## map: function
## map_df: function
## n.breaks.cache: NULL
## na.translate: TRUE
## na.value: grey50
## name:
## palette: function
## palette.cache: NULL
## position: left
## range: <ggproto object: Class RangeDiscrete, Range, gg>
## range: NULL
## reset: function
## train: function
## super: <ggproto object: Class RangeDiscrete, Range, gg>
## rescale: function
## reset: function
## scale_name: manual
## train: function
## train_df: function
## transform: function
## transform_df: function
## super: <ggproto object: Class ScaleDiscrete, Scale, gg>
map4
map4 <- ggplot(OpenSpace) +
annotation_map_tile(zoomin = 0, progress = "none", type = "cartolight") +
geom_sf() +
labs(caption = "Map tiles and data by OpenStreetMap") +
geom_sf() +
geom_sf(data = ParkLightGDB,
size = 0.01,
aes(color = "chocolate1")) +
geom_sf(data = OpenSpace2, color = "black",
size = 0.2,
alpha = 0.15,
aes(fill = "OpenSpace2")) +
scale_fill_manual(values = "aquamarine", name = "")
scale_color_manual(values = c("chocolate1"), name = "")
## <ggproto object: Class ScaleDiscrete, Scale, gg>
## aesthetics: colour
## axis_order: function
## break_info: function
## break_positions: function
## breaks: waiver
## call: call
## clone: function
## dimension: function
## drop: TRUE
## expand: waiver
## get_breaks: function
## get_breaks_minor: function
## get_labels: function
## get_limits: function
## guide: legend
## is_discrete: function
## is_empty: function
## labels: waiver
## limits: NULL
## make_sec_title: function
## make_title: function
## map: function
## map_df: function
## n.breaks.cache: NULL
## na.translate: TRUE
## na.value: grey50
## name:
## palette: function
## palette.cache: NULL
## position: left
## range: <ggproto object: Class RangeDiscrete, Range, gg>
## range: NULL
## reset: function
## train: function
## super: <ggproto object: Class RangeDiscrete, Range, gg>
## rescale: function
## reset: function
## scale_name: manual
## train: function
## train_df: function
## transform: function
## transform_df: function
## super: <ggproto object: Class ScaleDiscrete, Scale, gg>
map4
## Loading required namespace: raster
map4 <- ggplot(OpenSpace) +
annotation_map_tile(zoomin = 0, progress = "none", type = "stamenbw") +
geom_sf() +
labs(caption = "Map tiles by Stamen Design. Data by OpenStreetMap") +
geom_sf() +
geom_sf(data = ParkLightGDB,
size = 0.1,
aes(color = "brown1")) +
geom_sf(data = OpenSpace2, color = "aquamarine2",
size = 0.2,
alpha = 0.25,
aes(fill = "OpenSpace2")) +
scale_fill_manual(values = "chartreuse2", name = "")
scale_color_manual(values = c("chocolate1"), name = "")
## <ggproto object: Class ScaleDiscrete, Scale, gg>
## aesthetics: colour
## axis_order: function
## break_info: function
## break_positions: function
## breaks: waiver
## call: call
## clone: function
## dimension: function
## drop: TRUE
## expand: waiver
## get_breaks: function
## get_breaks_minor: function
## get_labels: function
## get_limits: function
## guide: legend
## is_discrete: function
## is_empty: function
## labels: waiver
## limits: NULL
## make_sec_title: function
## make_title: function
## map: function
## map_df: function
## n.breaks.cache: NULL
## na.translate: TRUE
## na.value: grey50
## name:
## palette: function
## palette.cache: NULL
## position: left
## range: <ggproto object: Class RangeDiscrete, Range, gg>
## range: NULL
## reset: function
## train: function
## super: <ggproto object: Class RangeDiscrete, Range, gg>
## rescale: function
## reset: function
## scale_name: manual
## train: function
## train_df: function
## transform: function
## transform_df: function
## super: <ggproto object: Class ScaleDiscrete, Scale, gg>
map4
map4 <- ggplot() +
annotation_map_tile(zoomin = 0, progress = "none", type = "stamenbw") +
geom_sf() +
labs(caption = "Map tiles by Stamen Design. Data by OpenStreetMap") +
geom_sf() +
geom_sf(data = ParkLightGDB,
size = 0.1,
aes(color = "brown1")) +
geom_sf(data = OpenSpace2, color = "aquamarine2",
size = 0.2,
alpha = 0.25,
aes(fill = "OpenSpace2")) +
scale_fill_manual(values = "chartreuse2", name = "")
scale_color_manual(values = c("chocolate1"), name = "")
## <ggproto object: Class ScaleDiscrete, Scale, gg>
## aesthetics: colour
## axis_order: function
## break_info: function
## break_positions: function
## breaks: waiver
## call: call
## clone: function
## dimension: function
## drop: TRUE
## expand: waiver
## get_breaks: function
## get_breaks_minor: function
## get_labels: function
## get_limits: function
## guide: legend
## is_discrete: function
## is_empty: function
## labels: waiver
## limits: NULL
## make_sec_title: function
## make_title: function
## map: function
## map_df: function
## n.breaks.cache: NULL
## na.translate: TRUE
## na.value: grey50
## name:
## palette: function
## palette.cache: NULL
## position: left
## range: <ggproto object: Class RangeDiscrete, Range, gg>
## range: NULL
## reset: function
## train: function
## super: <ggproto object: Class RangeDiscrete, Range, gg>
## rescale: function
## reset: function
## scale_name: manual
## train: function
## train_df: function
## transform: function
## transform_df: function
## super: <ggproto object: Class ScaleDiscrete, Scale, gg>
map4
map4 <- ggplot() +
annotation_map_tile(zoomin = 0, progress = "none", type = "stamenbw") +
geom_sf() +
labs(caption = "Map tiles by Stamen Design. Data by OpenStreetMap") +
geom_sf() +
geom_sf(data = OpenSpace2, color = "aquamarine2",
size = 0.2,
alpha = 0.25,
aes(fill = "OpenSpace2")) +
geom_sf(data = ParkLightGDB,
size = 0.1,
aes(color = "brown1")) +
scale_fill_manual(values = "chartreuse2", name = "")
scale_color_manual(values = c("chocolate1"), name = "")
## <ggproto object: Class ScaleDiscrete, Scale, gg>
## aesthetics: colour
## axis_order: function
## break_info: function
## break_positions: function
## breaks: waiver
## call: call
## clone: function
## dimension: function
## drop: TRUE
## expand: waiver
## get_breaks: function
## get_breaks_minor: function
## get_labels: function
## get_limits: function
## guide: legend
## is_discrete: function
## is_empty: function
## labels: waiver
## limits: NULL
## make_sec_title: function
## make_title: function
## map: function
## map_df: function
## n.breaks.cache: NULL
## na.translate: TRUE
## na.value: grey50
## name:
## palette: function
## palette.cache: NULL
## position: left
## range: <ggproto object: Class RangeDiscrete, Range, gg>
## range: NULL
## reset: function
## train: function
## super: <ggproto object: Class RangeDiscrete, Range, gg>
## rescale: function
## reset: function
## scale_name: manual
## train: function
## train_df: function
## transform: function
## transform_df: function
## super: <ggproto object: Class ScaleDiscrete, Scale, gg>
map4
map4 <- ggplot() +
annotation_map_tile(zoomin = 0, progress = "none", type = "cartolight") +
geom_sf() +
labs(caption = "Map tiles and data by OpenStreetMap") +
geom_sf() +
geom_sf(data = OpenSpace2, color = "chartreuse3",
size = 0.2,
alpha = 0.25,
aes(fill = "OpenSpace2")) +
geom_sf(data = ParkLightGDB,
size = 0.1,
aes(color = "darkgoldenrod2")) +
scale_fill_manual(values = "chartreuse2", name = "") +
scale_color_manual(values = c("darkgoldenrod2"), name = "") +
theme_void()
map4